(function(root) {


	var SQLParser = function() {
		
		function require(path){ 
			return require[path];
		}
		
		require['./lexer'] = new function() {
			var exports = this;
			(function() {
				var Lexer;

				Lexer = (function() {
					var BOOLEAN, DBLSTRING, LITERAL, MATH, MATH_MULTI, NUMBER, SEPARATOR, SQL_CONDITIONALS, SQL_FUNCTIONS, SQL_KEYWORDS, SQL_OPERATORS, SQL_SORT_ORDERS, STAR, STRING, WHITESPACE;

					function Lexer(sql, opts) {
						var bytesConsumed, i;
						if (opts == null) opts = {};
						this.sql = sql;
						this.preserveWhitespace = opts.preserveWhitespace || false;
						this.tokens = [];
						this.currentLine = 1;
						i = 0;
						  while (this.chunk = sql.slice(i)) {
							bytesConsumed = this.keywordToken() || this.starToken() || this.booleanToken() || this.functionToken() || this.windowExtension() || this.sortOrderToken() || this.seperatorToken() || this.operatorToken() || this.mathToken() || this.dotToken() || this.conditionalToken() || this.numberToken() || this.stringToken() || this.parensToken() || this.whitespaceToken() || this.literalToken();
							if (bytesConsumed < 1) {
							  throw new Error("NOTHING CONSUMED: Stopped at - '" + (this.chunk.slice(0, 30)) + "'");
							}
							i += bytesConsumed;
						  }
						this.token('EOF', '');
					}

					Lexer.prototype.token = function(name, value) {
					  return this.tokens.push([name, value, this.currentLine]);
					};

					Lexer.prototype.tokenizeFromRegex = function(name, regex, part, lengthPart, output) {
					  var match, partMatch;
					  if (part == null) part = 0;
					  if (lengthPart == null) lengthPart = part;
					  if (output == null) output = true;
					  if (!(match = regex.exec(this.chunk))) return 0;
					  partMatch = match[part];
					  if (output) this.token(name, partMatch);
					  return match[lengthPart].length;
					};

					Lexer.prototype.tokenizeFromWord = function(name, word) {
					  var match, matcher;
					  if (word == null) word = name;
					  word = this.regexEscape(word);
					  matcher = /^\w+$/.test(word) ? new RegExp("^(" + word + ")\\b", 'ig') : new RegExp("^(" + word + ")", 'ig');
					  match = matcher.exec(this.chunk);
					  if (!match) return 0;
					  this.token(name, match[1]);
					  return match[1].length;
					};

					Lexer.prototype.tokenizeFromList = function(name, list) {
					  var entry, ret, _i, _len;
					  ret = 0;
					  for (_i = 0, _len = list.length; _i < _len; _i++) {
						entry = list[_i];
						ret = this.tokenizeFromWord(name, entry);
						if (ret > 0) break;
					  }
					  return ret;
					};

					Lexer.prototype.keywordToken = function() {
					  return this.tokenizeFromWord('SELECT') || this.tokenizeFromWord('DISTINCT') || this.tokenizeFromWord('FROM') || this.tokenizeFromWord('WHERE') || this.tokenizeFromWord('GROUP') || this.tokenizeFromWord('ORDER') || this.tokenizeFromWord('BY') || this.tokenizeFromWord('HAVING') || this.tokenizeFromWord('LIMIT') || this.tokenizeFromWord('JOIN') || this.tokenizeFromWord('LEFT') || this.tokenizeFromWord('RIGHT') || this.tokenizeFromWord('INNER') || this.tokenizeFromWord('OUTER') || this.tokenizeFromWord('ON') || this.tokenizeFromWord('AS') || this.tokenizeFromWord('UNION') || this.tokenizeFromWord('ALL') || this.tokenizeFromWord('INSERT') || this.tokenizeFromWord('INTO') || this.tokenizeFromWord('VALUES') || this.tokenizeFromWord('DELETE') || this.tokenizeFromWord('UPDATE') || this.tokenizeFromWord('SET');
					};

					Lexer.prototype.dotToken = function() {
					  return this.tokenizeFromWord('DOT', '.');
					};

					Lexer.prototype.operatorToken = function() {
					  return this.tokenizeFromList('OPERATOR', SQL_OPERATORS);
					};

					Lexer.prototype.mathToken = function() {
					  return this.tokenizeFromList('MATH', MATH) || this.tokenizeFromList('MATH_MULTI', MATH_MULTI);
					};

					Lexer.prototype.conditionalToken = function() {
					  return this.tokenizeFromList('CONDITIONAL', SQL_CONDITIONALS);
					};

					Lexer.prototype.functionToken = function() {
					  return this.tokenizeFromList('FUNCTION', SQL_FUNCTIONS);
					};

					Lexer.prototype.sortOrderToken = function() {
					  return this.tokenizeFromList('DIRECTION', SQL_SORT_ORDERS);
					};

					Lexer.prototype.booleanToken = function() {
					  return this.tokenizeFromList('BOOLEAN', BOOLEAN);
					};

					Lexer.prototype.starToken = function() {
					  return this.tokenizeFromRegex('STAR', STAR);
					};

					Lexer.prototype.seperatorToken = function() {
					  return this.tokenizeFromRegex('SEPARATOR', SEPARATOR);
					};

					Lexer.prototype.literalToken = function() {
					  return this.tokenizeFromRegex('LITERAL', LITERAL, 1, 0);
					};

					Lexer.prototype.numberToken = function() {
					  return this.tokenizeFromRegex('NUMBER', NUMBER);
					};

					Lexer.prototype.stringToken = function() {
					  return this.tokenizeFromRegex('STRING', STRING, 1, 0) || this.tokenizeFromRegex('DBLSTRING', DBLSTRING, 1, 0);
					};

					Lexer.prototype.parensToken = function() {
					  return this.tokenizeFromRegex('LEFT_PAREN', /^\(/) || this.tokenizeFromRegex('RIGHT_PAREN', /^\)/);
					};

					Lexer.prototype.windowExtension = function() {
					  var match;
					  match = /^\.(win):(length|time)/i.exec(this.chunk);
					  if (!match) return 0;
					  this.token('WINDOW', match[1]);
					  this.token('WINDOW_FUNCTION', match[2]);
					  return match[0].length;
					};

					Lexer.prototype.whitespaceToken = function() {
					  var match, newlines, partMatch;
					  if (!(match = WHITESPACE.exec(this.chunk))) return 0;
					  partMatch = match[0];
					  newlines = partMatch.replace(/[^\n]/, '').length;
					  this.currentLine += newlines;
					  if (this.preserveWhitespace) this.token(name, partMatch);
					  return partMatch.length;
					};

					Lexer.prototype.regexEscape = function(str) {
					  return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
					};

					SQL_KEYWORDS = ['SELECT', 'FROM', 'WHERE', 'GROUP BY', 'ORDER BY', 'HAVING', 'AS', 'INSERT', 'INTO', 'UPDATE', 'SET', 'DELETE'];

					SQL_FUNCTIONS = ['AVG', 'COUNT', 'MIN', 'MAX', 'SUM'];

					SQL_SORT_ORDERS = ['ASC', 'DESC'];

					SQL_OPERATORS = ['=', '>', '<', 'LIKE', 'IS NOT', 'IS', 'IN'];

					SQL_CONDITIONALS = ['AND', 'OR'];

					BOOLEAN = ['TRUE', 'FALSE', 'NULL'];

					MATH = ['+', '-'];

					MATH_MULTI = ['/', '*'];

					STAR = /^\*/;

					SEPARATOR = /^,/;

					WHITESPACE = /^[ \n\r]+/;

					LITERAL = /^`?([a-z_][a-z0-9_]{0,})`?/i;

					NUMBER = /^[0-9]+(\.[0-9]+)?/;

					STRING = /^'([^\\']*(?:\\.[^\\']*)*)'/;

					DBLSTRING = /^"([^\\"]*(?:\\.[^\\"]*)*)"/;

					return Lexer;

				})();

			    exports.tokenize = function(sql, opts) {
					return (new Lexer(sql, opts)).tokens;
				};

			}).call(this);

		};

		require['./compiled_parser'] = new function() {
		
			var exports = this;

/* Jison generated parser */
var parser = (function(){
var parser = {trace: function trace() { },
yy: {},
symbols_: {"error":2,"Root":3,"Query":4,"EOF":5,"SelectQuery":6,"Unions":7,"InsertQuery":8,"DeleteQuery":9,"UpdateQuery":10,"SelectWithLimitQuery":11,"BasicSelectQuery":12,"Select":13,"OrderClause":14,"GroupClause":15,"LimitClause":16,"SelectClause":17,"WhereClause":18,"SELECT":19,"Fields":20,"FROM":21,"Table":22,"DISTINCT":23,"Joins":24,"INSERT":25,"INTO":26,"Literal":27,"VALUES":28,"LEFT_PAREN":29,"ArgumentList":30,"RIGHT_PAREN":31,"DELETE":32,"STAR":33,"UPDATE":34,"SET":35,"AssignmentList":36,"AS":37,"WINDOW":38,"WINDOW_FUNCTION":39,"Number":40,"Union":41,"UNION":42,"ALL":43,"Join":44,"JOIN":45,"ON":46,"Expression":47,"LEFT":48,"RIGHT":49,"INNER":50,"OUTER":51,"WHERE":52,"LIMIT":53,"ORDER":54,"BY":55,"OrderArgs":56,"OrderArg":57,"SEPARATOR":58,"Value":59,"DIRECTION":60,"GroupBasicClause":61,"HavingClause":62,"GROUP":63,"HAVING":64,"MATH":65,"MATH_MULTI":66,"OPERATOR":67,"CONDITIONAL":68,"String":69,"Function":70,"UserFunction":71,"Boolean":72,"NUMBER":73,"BOOLEAN":74,"STRING":75,"DBLSTRING":76,"LITERAL":77,"DOT":78,"FUNCTION":79,"Field":80,"$accept":0,"$end":1},
terminals_: {2:"error",5:"EOF",19:"SELECT",21:"FROM",23:"DISTINCT",25:"INSERT",26:"INTO",28:"VALUES",29:"LEFT_PAREN",31:"RIGHT_PAREN",32:"DELETE",33:"STAR",34:"UPDATE",35:"SET",37:"AS",38:"WINDOW",39:"WINDOW_FUNCTION",42:"UNION",43:"ALL",45:"JOIN",46:"ON",48:"LEFT",49:"RIGHT",50:"INNER",51:"OUTER",52:"WHERE",53:"LIMIT",54:"ORDER",55:"BY",58:"SEPARATOR",60:"DIRECTION",63:"GROUP",64:"HAVING",65:"MATH",66:"MATH_MULTI",67:"OPERATOR",68:"CONDITIONAL",73:"NUMBER",74:"BOOLEAN",75:"STRING",76:"DBLSTRING",77:"LITERAL",78:"DOT",79:"FUNCTION"},
productions_: [0,[3,2],[4,1],[4,2],[4,1],[4,1],[4,1],[6,1],[6,1],[12,1],[12,2],[12,2],[12,3],[11,2],[13,1],[13,2],[17,4],[17,5],[17,5],[17,6],[8,7],[8,4],[9,4],[9,5],[9,3],[9,4],[10,4],[10,5],[22,1],[22,3],[22,2],[22,3],[22,4],[22,6],[7,1],[7,2],[41,2],[41,3],[24,1],[24,2],[44,4],[44,5],[44,5],[44,6],[44,6],[44,6],[44,6],[18,2],[16,2],[14,3],[56,1],[56,3],[57,1],[57,2],[15,1],[15,2],[61,3],[62,2],[47,3],[47,3],[47,3],[47,3],[47,3],[47,3],[47,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[40,1],[72,1],[69,1],[69,1],[27,1],[27,3],[70,4],[71,4],[30,1],[30,3],[36,1],[36,3],[20,1],[20,3],[80,1],[80,1],[80,3]],
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {

var $0 = $$.length - 1;
switch (yystate) {
case 1:return this.$ = $$[$0-1];
break;
case 2:this.$ = $$[$0];
break;
case 3:this.$ = (function () {
        $$[$0-1].unions = $$[$0];
        return $$[$0-1];
      }());
break;
case 4:this.$ = $$[$0];
break;
case 5:this.$ = $$[$0];
break;
case 6:this.$ = $$[$0];
break;
case 7:this.$ = $$[$0];
break;
case 8:this.$ = $$[$0];
break;
case 9:this.$ = $$[$0];
break;
case 10:this.$ = (function () {
        $$[$0-1].order = $$[$0];
        return $$[$0-1];
      }());
break;
case 11:this.$ = (function () {
        $$[$0-1].group = $$[$0];
        return $$[$0-1];
      }());
break;
case 12:this.$ = (function () {
        $$[$0-2].group = $$[$0-1];
        $$[$0-2].order = $$[$0];
        return $$[$0-2];
      }());
break;
case 13:this.$ = (function () {
        $$[$0-1].limit = $$[$0];
        return $$[$0-1];
      }());
break;
case 14:this.$ = $$[$0];
break;
case 15:this.$ = (function () {
        $$[$0-1].where = $$[$0];
        return $$[$0-1];
      }());
break;
case 16:this.$ = new yy.Select($$[$0-2], $$[$0], false);
break;
case 17:this.$ = new yy.Select($$[$0-2], $$[$0], true);
break;
case 18:this.$ = new yy.Select($$[$0-3], $$[$0-1], false, $$[$0]);
break;
case 19:this.$ = new yy.Select($$[$0-3], $$[$0-1], true, $$[$0]);
break;
case 20:this.$ = new yy.Insert($$[$0-4], $$[$0-1]);
break;
case 21:this.$ = new yy.Insert($$[$0-1], $$[$0]);
break;
case 22:this.$ = new yy.Delete($$[$0], true);
break;
case 23:this.$ = new yy.Delete($$[$0-1], $$[$0]);
break;
case 24:this.$ = new yy.Delete($$[$0], true);
break;
case 25:this.$ = new yy.Delete($$[$0-1], $$[$0]);
break;
case 26:this.$ = new yy.Update($$[$0-2], $$[$0]);
break;
case 27:this.$ = new yy.Update($$[$0-3], $$[$0-1], $$[$0]);
break;
case 28:this.$ = new yy.Table($$[$0]);
break;
case 29:this.$ = new yy.Table($$[$0-2], $$[$0]);
break;
case 30:this.$ = new yy.Table($$[$0-1], $$[$0]);
break;
case 31:this.$ = new yy.SubSelect($$[$0-1]);
break;
case 32:this.$ = new yy.SubSelect($$[$0-2], $$[$0]);
break;
case 33:this.$ = new yy.Table($$[$0-5], $$[$0-4], $$[$0-3], $$[$0-1]);
break;
case 34:this.$ = [$$[$0]];
break;
case 35:this.$ = $$[$0-1].concat($$[$01]);
break;
case 36:this.$ = new yy.Union($$[$0]);
break;
case 37:this.$ = new yy.Union($$[$0], true);
break;
case 38:this.$ = [$$[$0]];
break;
case 39:this.$ = $$[$0-1].concat($$[$0]);
break;
case 40:this.$ = new yy.Join($$[$0-2], $$[$0]);
break;
case 41:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT');
break;
case 42:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT');
break;
case 43:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'INNER');
break;
case 44:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'INNER');
break;
case 45:this.$ = new yy.Join($$[$0-2], $$[$0], 'LEFT', 'OUTER');
break;
case 46:this.$ = new yy.Join($$[$0-2], $$[$0], 'RIGHT', 'OUTER');
break;
case 47:this.$ = new yy.Where($$[$0]);
break;
case 48:this.$ = new yy.Limit($$[$0]);
break;
case 49:this.$ = new yy.Order($$[$0]);
break;
case 50:this.$ = [$$[$0]];
break;
case 51:this.$ = $$[$0-2].concat($$[$0]);
break;
case 52:this.$ = new yy.OrderArgument($$[$0], 'ASC');
break;
case 53:this.$ = new yy.OrderArgument($$[$0-1], $$[$0]);
break;
case 54:this.$ = $$[$0];
break;
case 55:this.$ = (function () {
        $$[$0-1].having = $$[$0];
        return $$[$0-1];
      }());
break;
case 56:this.$ = new yy.Group($$[$0]);
break;
case 57:this.$ = new yy.Having($$[$0]);
break;
case 58:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
break;
case 59:this.$ = $$[$0-1];
break;
case 60:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
break;
case 61:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
break;
case 62:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
break;
case 63:this.$ = new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
break;
case 64:this.$ = $$[$0];
break;
case 65:this.$ = $$[$0];
break;
case 66:this.$ = $$[$0];
break;
case 67:this.$ = $$[$0];
break;
case 68:this.$ = $$[$0];
break;
case 69:this.$ = $$[$0];
break;
case 70:this.$ = $$[$0];
break;
case 71:this.$ = new yy.NumberValue($$[$0]);
break;
case 72:this.$ = new yy.BooleanValue($$[$0]);
break;
case 73:this.$ = new yy.StringValue($$[$0], "'");
break;
case 74:this.$ = new yy.StringValue($$[$0], '"');
break;
case 75:this.$ = new yy.LiteralValue($$[$0]);
break;
case 76:this.$ = new yy.LiteralValue($$[$0-2], $$[$0]);
break;
case 77:this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1]);
break;
case 78:this.$ = new yy.FunctionValue($$[$0-3], $$[$0-1], true);
break;
case 79:this.$ = [$$[$0]];
break;
case 80:this.$ = $$[$0-2].concat($$[$0]);
break;
case 81:this.$ = [$$[$0]];
break;
case 82:this.$ = $$[$0-2].concat($$[$0]);
break;
case 83:this.$ = [$$[$0]];
break;
case 84:this.$ = $$[$0-2].concat($$[$0]);
break;
case 85:this.$ = new yy.Star();
break;
case 86:this.$ = new yy.Field($$[$0], $$[$0]);
break;
case 87:this.$ = new yy.Field($$[$0-2], $$[$0]);
break;
}
},
table: [{3:1,4:2,6:3,8:4,9:5,10:6,11:7,12:8,13:12,17:13,19:[1,14],25:[1,9],32:[1,10],34:[1,11]},{1:[3]},{5:[1,15]},{5:[2,2],7:16,16:17,31:[2,2],41:18,42:[1,20],53:[1,19]},{5:[2,4],31:[2,4]},{5:[2,5],31:[2,5]},{5:[2,6],31:[2,6]},{5:[2,7],31:[2,7],42:[2,7],53:[2,7]},{5:[2,8],31:[2,8],42:[2,8],53:[2,8]},{26:[1,21]},{21:[1,23],33:[1,22]},{27:24,77:[1,25]},{5:[2,9],14:26,15:27,31:[2,9],42:[2,9],53:[2,9],54:[1,28],61:29,63:[1,30]},{5:[2,14],18:31,31:[2,14],42:[2,14],52:[1,32],53:[2,14],54:[2,14],63:[2,14]},{20:33,23:[1,34],27:40,29:[1,38],33:[1,36],40:41,47:37,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50],80:35},{1:[2,1]},{5:[2,3],31:[2,3],41:52,42:[1,20]},{5:[2,13],31:[2,13],42:[2,13],53:[2,13]},{5:[2,34],31:[2,34],42:[2,34]},{40:53,73:[1,47]},{6:54,11:7,12:8,13:12,17:13,19:[1,14],43:[1,55]},{27:56,77:[1,25]},{21:[1,57]},{27:58,77:[1,25]},{35:[1,59],78:[1,60]},{5:[2,75],19:[2,75],21:[2,75],28:[2,75],31:[2,75],35:[2,75],37:[2,75],38:[2,75],42:[2,75],45:[2,75],46:[2,75],48:[2,75],49:[2,75],52:[2,75],53:[2,75],54:[2,75],58:[2,75],63:[2,75],77:[2,75],78:[2,75]},{5:[2,10],31:[2,10],42:[2,10],53:[2,10]},{5:[2,11],14:61,31:[2,11],42:[2,11],53:[2,11],54:[1,28]},{55:[1,62]},{5:[2,54],31:[2,54],42:[2,54],53:[2,54],54:[2,54],62:63,64:[1,64]},{55:[1,65]},{5:[2,15],31:[2,15],42:[2,15],53:[2,15],54:[2,15],63:[2,15]},{27:40,29:[1,38],40:41,47:66,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{21:[1,67],58:[1,68]},{20:69,27:40,29:[1,38],33:[1,36],40:41,47:37,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50],80:35},{21:[2,83],58:[2,83]},{21:[2,85],58:[2,85]},{21:[2,86],37:[1,70],58:[2,86],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{13:75,17:13,19:[1,14],27:40,29:[1,38],40:41,47:76,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,64],21:[2,64],31:[2,64],37:[2,64],42:[2,64],45:[2,64],48:[2,64],49:[2,64],52:[2,64],53:[2,64],54:[2,64],58:[2,64],63:[2,64],64:[2,64],65:[2,64],66:[2,64],67:[2,64],68:[2,64]},{5:[2,65],21:[2,65],31:[2,65],37:[2,65],42:[2,65],45:[2,65],48:[2,65],49:[2,65],52:[2,65],53:[2,65],54:[2,65],58:[2,65],60:[2,65],63:[2,65],64:[2,65],65:[2,65],66:[2,65],67:[2,65],68:[2,65],78:[1,60]},{5:[2,66],21:[2,66],31:[2,66],37:[2,66],42:[2,66],45:[2,66],48:[2,66],49:[2,66],52:[2,66],53:[2,66],54:[2,66],58:[2,66],60:[2,66],63:[2,66],64:[2,66],65:[2,66],66:[2,66],67:[2,66],68:[2,66]},{5:[2,67],21:[2,67],31:[2,67],37:[2,67],42:[2,67],45:[2,67],48:[2,67],49:[2,67],52:[2,67],53:[2,67],54:[2,67],58:[2,67],60:[2,67],63:[2,67],64:[2,67],65:[2,67],66:[2,67],67:[2,67],68:[2,67]},{5:[2,68],21:[2,68],31:[2,68],37:[2,68],42:[2,68],45:[2,68],48:[2,68],49:[2,68],52:[2,68],53:[2,68],54:[2,68],58:[2,68],60:[2,68],63:[2,68],64:[2,68],65:[2,68],66:[2,68],67:[2,68],68:[2,68]},{5:[2,69],21:[2,69],31:[2,69],37:[2,69],42:[2,69],45:[2,69],48:[2,69],49:[2,69],52:[2,69],53:[2,69],54:[2,69],58:[2,69],60:[2,69],63:[2,69],64:[2,69],65:[2,69],66:[2,69],67:[2,69],68:[2,69]},{5:[2,70],21:[2,70],31:[2,70],37:[2,70],42:[2,70],45:[2,70],48:[2,70],49:[2,70],52:[2,70],53:[2,70],54:[2,70],58:[2,70],60:[2,70],63:[2,70],64:[2,70],65:[2,70],66:[2,70],67:[2,70],68:[2,70]},{5:[2,75],21:[2,75],29:[1,77],31:[2,75],37:[2,75],42:[2,75],45:[2,75],48:[2,75],49:[2,75],52:[2,75],53:[2,75],54:[2,75],58:[2,75],60:[2,75],63:[2,75],64:[2,75],65:[2,75],66:[2,75],67:[2,75],68:[2,75],78:[2,75]},{5:[2,71],21:[2,71],31:[2,71],37:[2,71],42:[2,71],45:[2,71],48:[2,71],49:[2,71],52:[2,71],53:[2,71],54:[2,71],58:[2,71],60:[2,71],63:[2,71],64:[2,71],65:[2,71],66:[2,71],67:[2,71],68:[2,71]},{5:[2,73],21:[2,73],31:[2,73],37:[2,73],42:[2,73],45:[2,73],48:[2,73],49:[2,73],52:[2,73],53:[2,73],54:[2,73],58:[2,73],60:[2,73],63:[2,73],64:[2,73],65:[2,73],66:[2,73],67:[2,73],68:[2,73]},{5:[2,74],21:[2,74],31:[2,74],37:[2,74],42:[2,74],45:[2,74],48:[2,74],49:[2,74],52:[2,74],53:[2,74],54:[2,74],58:[2,74],60:[2,74],63:[2,74],64:[2,74],65:[2,74],66:[2,74],67:[2,74],68:[2,74]},{29:[1,78]},{5:[2,72],21:[2,72],31:[2,72],37:[2,72],42:[2,72],45:[2,72],48:[2,72],49:[2,72],52:[2,72],53:[2,72],54:[2,72],58:[2,72],60:[2,72],63:[2,72],64:[2,72],65:[2,72],66:[2,72],67:[2,72],68:[2,72]},{5:[2,35],31:[2,35],42:[2,35]},{5:[2,48],31:[2,48],42:[2,48],53:[2,48]},{5:[2,36],16:17,31:[2,36],42:[2,36],53:[1,19]},{6:79,11:7,12:8,13:12,17:13,19:[1,14]},{6:81,11:7,12:8,13:12,17:13,19:[1,14],28:[1,80],78:[1,60]},{27:82,77:[1,25]},{5:[2,24],18:83,31:[2,24],52:[1,32],78:[1,60]},{27:40,29:[1,38],36:84,40:41,47:85,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{77:[1,86]},{5:[2,12],31:[2,12],42:[2,12],53:[2,12]},{27:40,40:41,56:87,57:88,59:89,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,55],31:[2,55],42:[2,55],53:[2,55],54:[2,55]},{27:40,29:[1,38],40:41,47:90,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],30:91,40:41,47:92,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,47],31:[2,47],42:[2,47],53:[2,47],54:[2,47],63:[2,47],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{22:93,27:94,29:[1,95],77:[1,25]},{27:40,29:[1,38],33:[1,36],40:41,47:37,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50],80:96},{21:[1,97],58:[1,68]},{27:98,77:[1,25]},{27:40,29:[1,38],40:41,47:99,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],40:41,47:100,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],40:41,47:101,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],40:41,47:102,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{31:[1,103]},{31:[1,104],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{27:40,29:[1,38],30:105,40:41,47:92,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],30:106,40:41,47:92,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,37],16:17,31:[2,37],42:[2,37],53:[1,19]},{29:[1,107]},{5:[2,21],16:17,31:[2,21],53:[1,19]},{5:[2,22],18:108,31:[2,22],52:[1,32],78:[1,60]},{5:[2,25],31:[2,25]},{5:[2,26],18:109,31:[2,26],52:[1,32],58:[1,110]},{5:[2,81],31:[2,81],52:[2,81],58:[2,81],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,76],19:[2,76],21:[2,76],28:[2,76],31:[2,76],35:[2,76],37:[2,76],38:[2,76],42:[2,76],45:[2,76],46:[2,76],48:[2,76],49:[2,76],52:[2,76],53:[2,76],54:[2,76],58:[2,76],60:[2,76],63:[2,76],64:[2,76],65:[2,76],66:[2,76],67:[2,76],68:[2,76],77:[2,76],78:[2,76]},{5:[2,49],31:[2,49],42:[2,49],53:[2,49],58:[1,111]},{5:[2,50],31:[2,50],42:[2,50],53:[2,50],58:[2,50]},{5:[2,52],31:[2,52],42:[2,52],53:[2,52],58:[2,52],60:[1,112]},{5:[2,57],31:[2,57],42:[2,57],53:[2,57],54:[2,57],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,56],31:[2,56],42:[2,56],53:[2,56],54:[2,56],58:[1,113],64:[2,56]},{5:[2,79],31:[2,79],42:[2,79],53:[2,79],54:[2,79],58:[2,79],64:[2,79],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,16],24:114,31:[2,16],42:[2,16],44:115,45:[1,116],48:[1,117],49:[1,118],52:[2,16],53:[2,16],54:[2,16],63:[2,16]},{5:[2,28],27:120,31:[2,28],37:[1,119],38:[1,121],42:[2,28],45:[2,28],46:[2,28],48:[2,28],49:[2,28],52:[2,28],53:[2,28],54:[2,28],63:[2,28],77:[1,25],78:[1,60]},{4:122,6:3,8:4,9:5,10:6,11:7,12:8,13:12,17:13,19:[1,14],25:[1,9],32:[1,10],34:[1,11]},{21:[2,84],58:[2,84]},{22:123,27:94,29:[1,95],77:[1,25]},{21:[2,87],58:[2,87],78:[1,60]},{5:[2,60],21:[2,60],31:[2,60],37:[2,60],42:[2,60],45:[2,60],48:[2,60],49:[2,60],52:[2,60],53:[2,60],54:[2,60],58:[2,60],63:[2,60],64:[2,60],65:[2,60],66:[1,72],67:[2,60],68:[2,60]},{5:[2,61],21:[2,61],31:[2,61],37:[2,61],42:[2,61],45:[2,61],48:[2,61],49:[2,61],52:[2,61],53:[2,61],54:[2,61],58:[2,61],63:[2,61],64:[2,61],65:[2,61],66:[2,61],67:[2,61],68:[2,61]},{5:[2,62],21:[2,62],31:[2,62],37:[2,62],42:[2,62],45:[2,62],48:[2,62],49:[2,62],52:[2,62],53:[2,62],54:[2,62],58:[2,62],63:[2,62],64:[2,62],65:[1,71],66:[1,72],67:[2,62],68:[2,62]},{5:[2,63],21:[2,63],31:[2,63],37:[2,63],42:[2,63],45:[2,63],48:[2,63],49:[2,63],52:[2,63],53:[2,63],54:[2,63],58:[2,63],63:[2,63],64:[2,63],65:[1,71],66:[1,72],67:[1,73],68:[2,63]},{5:[2,58],21:[2,58],31:[2,58],37:[2,58],42:[2,58],45:[2,58],48:[2,58],49:[2,58],52:[2,58],53:[2,58],54:[2,58],58:[2,58],63:[2,58],64:[2,58],65:[2,58],66:[2,58],67:[2,58],68:[2,58]},{5:[2,59],21:[2,59],31:[2,59],37:[2,59],42:[2,59],45:[2,59],48:[2,59],49:[2,59],52:[2,59],53:[2,59],54:[2,59],58:[2,59],63:[2,59],64:[2,59],65:[2,59],66:[2,59],67:[2,59],68:[2,59]},{31:[1,124],58:[1,113]},{31:[1,125],58:[1,113]},{27:40,29:[1,38],30:126,40:41,47:92,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,23],31:[2,23]},{5:[2,27],31:[2,27]},{27:40,29:[1,38],40:41,47:127,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,40:41,57:128,59:89,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,53],31:[2,53],42:[2,53],53:[2,53],58:[2,53]},{27:40,29:[1,38],40:41,47:129,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,18],31:[2,18],42:[2,18],44:130,45:[1,116],48:[1,117],49:[1,118],52:[2,18],53:[2,18],54:[2,18],63:[2,18]},{5:[2,38],31:[2,38],42:[2,38],45:[2,38],48:[2,38],49:[2,38],52:[2,38],53:[2,38],54:[2,38],63:[2,38]},{22:131,27:94,29:[1,95],77:[1,25]},{45:[1,132],50:[1,133],51:[1,134]},{45:[1,135],50:[1,136],51:[1,137]},{27:138,77:[1,25]},{5:[2,30],31:[2,30],42:[2,30],45:[2,30],46:[2,30],48:[2,30],49:[2,30],52:[2,30],53:[2,30],54:[2,30],63:[2,30],78:[1,60]},{39:[1,139]},{31:[1,140]},{5:[2,17],24:141,31:[2,17],42:[2,17],44:115,45:[1,116],48:[1,117],49:[1,118],52:[2,17],53:[2,17],54:[2,17],63:[2,17]},{5:[2,78],21:[2,78],31:[2,78],37:[2,78],42:[2,78],45:[2,78],48:[2,78],49:[2,78],52:[2,78],53:[2,78],54:[2,78],58:[2,78],60:[2,78],63:[2,78],64:[2,78],65:[2,78],66:[2,78],67:[2,78],68:[2,78]},{5:[2,77],21:[2,77],31:[2,77],37:[2,77],42:[2,77],45:[2,77],48:[2,77],49:[2,77],52:[2,77],53:[2,77],54:[2,77],58:[2,77],60:[2,77],63:[2,77],64:[2,77],65:[2,77],66:[2,77],67:[2,77],68:[2,77]},{31:[1,142],58:[1,113]},{5:[2,82],31:[2,82],52:[2,82],58:[2,82],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,51],31:[2,51],42:[2,51],53:[2,51],58:[2,51]},{5:[2,80],31:[2,80],42:[2,80],53:[2,80],54:[2,80],58:[2,80],64:[2,80],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,39],31:[2,39],42:[2,39],45:[2,39],48:[2,39],49:[2,39],52:[2,39],53:[2,39],54:[2,39],63:[2,39]},{46:[1,143]},{22:144,27:94,29:[1,95],77:[1,25]},{45:[1,145]},{45:[1,146]},{22:147,27:94,29:[1,95],77:[1,25]},{45:[1,148]},{45:[1,149]},{5:[2,29],31:[2,29],42:[2,29],45:[2,29],46:[2,29],48:[2,29],49:[2,29],52:[2,29],53:[2,29],54:[2,29],63:[2,29],78:[1,60]},{29:[1,150]},{5:[2,31],27:151,31:[2,31],42:[2,31],45:[2,31],46:[2,31],48:[2,31],49:[2,31],52:[2,31],53:[2,31],54:[2,31],63:[2,31],77:[1,25]},{5:[2,19],31:[2,19],42:[2,19],44:130,45:[1,116],48:[1,117],49:[1,118],52:[2,19],53:[2,19],54:[2,19],63:[2,19]},{5:[2,20],31:[2,20]},{27:40,29:[1,38],40:41,47:152,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{46:[1,153]},{22:154,27:94,29:[1,95],77:[1,25]},{22:155,27:94,29:[1,95],77:[1,25]},{46:[1,156]},{22:157,27:94,29:[1,95],77:[1,25]},{22:158,27:94,29:[1,95],77:[1,25]},{40:159,73:[1,47]},{5:[2,32],31:[2,32],42:[2,32],45:[2,32],46:[2,32],48:[2,32],49:[2,32],52:[2,32],53:[2,32],54:[2,32],63:[2,32],78:[1,60]},{5:[2,40],31:[2,40],42:[2,40],45:[2,40],48:[2,40],49:[2,40],52:[2,40],53:[2,40],54:[2,40],63:[2,40],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{27:40,29:[1,38],40:41,47:160,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{46:[1,161]},{46:[1,162]},{27:40,29:[1,38],40:41,47:163,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{46:[1,164]},{46:[1,165]},{31:[1,166]},{5:[2,41],31:[2,41],42:[2,41],45:[2,41],48:[2,41],49:[2,41],52:[2,41],53:[2,41],54:[2,41],63:[2,41],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{27:40,29:[1,38],40:41,47:167,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],40:41,47:168,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,42],31:[2,42],42:[2,42],45:[2,42],48:[2,42],49:[2,42],52:[2,42],53:[2,42],54:[2,42],63:[2,42],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{27:40,29:[1,38],40:41,47:169,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{27:40,29:[1,38],40:41,47:170,59:39,69:42,70:43,71:44,72:45,73:[1,47],74:[1,51],75:[1,48],76:[1,49],77:[1,46],79:[1,50]},{5:[2,33],31:[2,33],42:[2,33],45:[2,33],46:[2,33],48:[2,33],49:[2,33],52:[2,33],53:[2,33],54:[2,33],63:[2,33]},{5:[2,43],31:[2,43],42:[2,43],45:[2,43],48:[2,43],49:[2,43],52:[2,43],53:[2,43],54:[2,43],63:[2,43],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,45],31:[2,45],42:[2,45],45:[2,45],48:[2,45],49:[2,45],52:[2,45],53:[2,45],54:[2,45],63:[2,45],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,44],31:[2,44],42:[2,44],45:[2,44],48:[2,44],49:[2,44],52:[2,44],53:[2,44],54:[2,44],63:[2,44],65:[1,71],66:[1,72],67:[1,73],68:[1,74]},{5:[2,46],31:[2,46],42:[2,46],45:[2,46],48:[2,46],49:[2,46],52:[2,46],53:[2,46],54:[2,46],63:[2,46],65:[1,71],66:[1,72],67:[1,73],68:[1,74]}],
defaultActions: {15:[2,1]},
parseError: function parseError(str, hash) {
    throw new Error(str);
},
parse: function parse(input) {
    var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
    this.lexer.setInput(input);
    this.lexer.yy = this.yy;
    this.yy.lexer = this.lexer;
    this.yy.parser = this;
    if (typeof this.lexer.yylloc == "undefined")
        this.lexer.yylloc = {};
    var yyloc = this.lexer.yylloc;
    lstack.push(yyloc);
    var ranges = this.lexer.options && this.lexer.options.ranges;
    if (typeof this.yy.parseError === "function")
        this.parseError = this.yy.parseError;
    function popStack(n) {
        stack.length = stack.length - 2 * n;
        vstack.length = vstack.length - n;
        lstack.length = lstack.length - n;
    }
    function lex() {
        var token;
        token = self.lexer.lex() || 1;
        if (typeof token !== "number") {
            token = self.symbols_[token] || token;
        }
        return token;
    }
    var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
    while (true) {
        state = stack[stack.length - 1];
        if (this.defaultActions[state]) {
            action = this.defaultActions[state];
        } else {
            if (symbol === null || typeof symbol == "undefined") {
                symbol = lex();
            }
            action = table[state] && table[state][symbol];
        }
        if (typeof action === "undefined" || !action.length || !action[0]) {
            var errStr = "";
            if (!recovering) {
                expected = [];
                for (p in table[state])
                    if (this.terminals_[p] && p > 2) {
                        expected.push("'" + this.terminals_[p] + "'");
                    }
                if (this.lexer.showPosition) {
                    errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
                } else {
                    errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'");
                }
                this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
            }
        }
        if (action[0] instanceof Array && action.length > 1) {
            throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
        }
        switch (action[0]) {
        case 1:
            stack.push(symbol);
            vstack.push(this.lexer.yytext);
            lstack.push(this.lexer.yylloc);
            stack.push(action[1]);
            symbol = null;
            if (!preErrorSymbol) {
                yyleng = this.lexer.yyleng;
                yytext = this.lexer.yytext;
                yylineno = this.lexer.yylineno;
                yyloc = this.lexer.yylloc;
                if (recovering > 0)
                    recovering--;
            } else {
                symbol = preErrorSymbol;
                preErrorSymbol = null;
            }
            break;
        case 2:
            len = this.productions_[action[1]][1];
            yyval.$ = vstack[vstack.length - len];
            yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column};
            if (ranges) {
                yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
            }
            r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
            if (typeof r !== "undefined") {
                return r;
            }
            if (len) {
                stack = stack.slice(0, -1 * len * 2);
                vstack = vstack.slice(0, -1 * len);
                lstack = lstack.slice(0, -1 * len);
            }
            stack.push(this.productions_[action[1]][0]);
            vstack.push(yyval.$);
            lstack.push(yyval._$);
            newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
            stack.push(newState);
            break;
        case 3:
            return true;
        }
    }
    return true;
}
};
undefined
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
return new Parser;
})();
if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
exports.parser = parser;
exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }
exports.main = function commonjsMain(args) {
    if (!args[1])
        throw new Error('Usage: '+args[0]+' FILE');
    var source, cwd;
    if (typeof process !== 'undefined') {
        source = require('fs').readFileSync(require('path').resolve(args[1]), "utf8");
    } else {
        source = require("file").path(require("file").cwd()).join(args[1]).read({charset: "utf-8"});
    }
    return exports.parser.parse(source);
}
if (typeof module !== 'undefined' && require.main === module) {
  exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
}
}

		};
		
		require['./nodes'] = new function() {
			var exports = this;
			(function() {
				var Field, FunctionValue, Group, Having, Join, Limit, LiteralValue, Op, Order, OrderArgument, Select, Insert, Delete, Update, Star, StringValue, SubSelect, Table, Union, Where, indent;

				indent = function(str) {
					var line;
					return ((function() {
						  var _i, _len, _ref, _results;
						  _ref = str.split("\n");
						  _results = [];
						  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
							line = _ref[_i];
							_results.push("  " + line);
						  }
						  return _results;
					})()).join("\n");
			    };

				exports.Select = Select = (function() {

					function Select(fields, source, distinct, joins, unions) {
					  this.fields = fields;
					  this.source = source;
					  this.distinct = distinct != null ? distinct : false;
					  this.joins = joins != null ? joins : [];
					  this.unions = unions != null ? unions : [];
					  this.order = null;
					  this.group = null;
					  this.where = null;
					  this.limit = null;
					}

					Select.prototype.toString = function() {
					  var join, ret, union, _i, _j, _len, _len2, _ref, _ref2;
					  ret = ["SELECT " + (this.fields.join(', '))];
					  ret.push(indent("FROM " + this.source));
					  _ref = this.joins;
					  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
						join = _ref[_i];
						ret.push(indent(join.toString()));
					  }
					  if (this.where) ret.push(indent(this.where.toString()));
					  if (this.group) ret.push(indent(this.group.toString()));
					  if (this.order) ret.push(indent(this.order.toString()));
					  if (this.limit) ret.push(indent(this.limit.toString()));
					  _ref2 = this.unions;
					  for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
						union = _ref2[_j];
						ret.push(union.toString());
					  }
					  return ret.join("\n");
					};

					return Select;

				})();

				exports.Insert = Insert = (function() {

					function Insert(target, insertExpression) {
					  this.target = target;
					  this.values = insertExpression
					}

					Insert.prototype.toString = function() {
						return ""
					};

					return Insert;

				})();
				
				exports.Delete = Delete = (function() {

					function Delete(target, deleteCondition) {
					  this.target = target;
					  this.deleteCondition = deleteCondition
					}

					Delete.prototype.toString = function() {
						return ""
					};

					return Delete;

				})();
				
				exports.Update = Update = (function(){
				
					function Update(target, assignList, updateCondition) {
					  this.target = target;
					  this.assignList = assignList;
					  this.updateCondition = updateCondition;
					}

					Update.prototype.toString = function() {
						return ""
					};

					return Update;				
				
				})();
				
				exports.SubSelect = SubSelect = (function() {

					function SubSelect(select, name) {
					  this.select = select;
					  this.name = name != null ? name : null;
					  null;
					}

					SubSelect.prototype.toString = function() {
					  var ret;
					  ret = [];
					  ret.push('(');
					  ret.push(indent(this.select.toString()));
					  ret.push(this.name ? ") " + (this.name.toString()) : ")");
					  return ret.join("\n");
					};

					return SubSelect;

				})();

				exports.Join = Join = (function() {

						function Join(right, conditions, side, mode) {
						  this.right = right;
						  this.conditions = conditions != null ? conditions : null;
						  this.side = side != null ? side : null;
						  this.mode = mode != null ? mode : null;
						  null;
						}

						Join.prototype.toString = function() {
						  var ret;
						  ret = '';
						  if (this.side != null) ret += "" + this.side + " ";
						  if (this.mode != null) ret += "" + this.mode + " ";
						  return ret + ("JOIN " + this.right + "\n") + indent("ON " + this.conditions);
						};

						return Join;

				})();

				exports.Union = Union = (function() {

					function Union(query, all) {
					  this.query = query;
					  this.all = all != null ? all : false;
					  null;
					}

					Union.prototype.toString = function() {
					  var all;
					  all = this.all ? ' ALL' : '';
					  return "UNION" + all + "\n" + (this.query.toString());
					};

					return Union;

				})();

				exports.LiteralValue = LiteralValue = (function() {

						function LiteralValue(value, value2) {
						  this.value = value;
						  this.value2 = value2 != null ? value2 : null;
						  if (this.value2) {
							this.nested = true;
							this.values = this.value.values;
							this.values.push(value2);
						  } else {
							this.nested = false;
							this.values = [this.value];
						  }
						}

						LiteralValue.prototype.toString = function() {
						  return "`" + (this.values.join('.')) + "`";
						};

						return LiteralValue;

				})();

				exports.StringValue = StringValue = (function() {

						function StringValue(value, quoteType) {
						  this.value = value;
						  this.quoteType = quoteType != null ? quoteType : "''";
						  null;
						}

						StringValue.prototype.toString = function() {
						  return "" + this.quoteType + this.value + this.quoteType;
						};

						return StringValue;

				})();

				exports.NumberValue = LiteralValue = (function() {

					function LiteralValue(value) {
					  this.value = Number(value);
					}

					LiteralValue.prototype.toString = function() {
					  return this.value.toString();
					};

					return LiteralValue;

				})();

				exports.BooleanValue = LiteralValue = (function() {

					function LiteralValue(value) {
					  this.value = (function() {
						switch (value.toLowerCase()) {
						  case 'true':
							return true;
						  case 'false':
							return false;
						  default:
							return null;
						}
					  })();
					}

					LiteralValue.prototype.toString = function() {
					  if (this.value != null) {
						return this.value.toString().toUpperCase();
					  } else {
						return 'NULL';
					  }
					};

					return LiteralValue;

				})();

				exports.FunctionValue = FunctionValue = (function() {

					function FunctionValue(name, _arguments, udf) {
					  this.name = name;
					  this.arguments = _arguments != null ? _arguments : [];
					  this.udf = udf != null ? udf : false;
					  null;
					}

					FunctionValue.prototype.toString = function() {
					  return "" + this.name + "(" + (this.arguments.join(', ')) + ")";
					};

					return FunctionValue;

				})();

				exports.Order = Order = (function() {

					function Order(orderings) {
					  this.orderings = orderings;
					}

					Order.prototype.toString = function() {
					  return "ORDER BY " + (this.orderings.join(', '));
					};

					return Order;

				})();

				exports.OrderArgument = OrderArgument = (function() {

					function OrderArgument(value, direction) {
					  this.value = value;
					  this.direction = direction != null ? direction : 'ASC';
					  null;
					}

					OrderArgument.prototype.toString = function() {
					  return "" + this.value + " " + this.direction;
					};

					return OrderArgument;

				})();

				exports.Limit = Limit = (function() {

					function Limit(value) {
					  this.value = value;
					  null;
					}

					Limit.prototype.toString = function() {
					  return "LIMIT " + this.value;
					};

					return Limit;

				})();

				exports.Table = Table = (function() {

					function Table(name, win, winFn, winArg) {
					  this.name = name;
					  this.win = win != null ? win : null;
					  this.winFn = winFn != null ? winFn : null;
					  this.winArg = winArg != null ? winArg : null;
					  null;
					}

					Table.prototype.toString = function() {
					  if (this.win) {
						return "" + this.name + "." + this.win + ":" + this.winFn + "(" + this.winArg + ")";
					  } else {
						return this.name.toString();
					  }
					};

					return Table;

				})();

				exports.Group = Group = (function() {

					function Group(fields) {
					  this.fields = fields;
					  this.having = null;
					}

					Group.prototype.toString = function() {
					  var ret;
					  ret = ["GROUP BY " + (this.fields.join(', '))];
					  if (this.having) ret.push(this.having.toString());
					  return ret.join("\n");
					};

					return Group;

				})();

				exports.Where = Where = (function() {

					function Where(conditions) {
					  this.conditions = conditions;
					  null;
					}

					Where.prototype.toString = function() {
					  return "WHERE " + this.conditions;
					};

					return Where;

				})();

				exports.Having = Having = (function() {

					function Having(conditions) {
					  this.conditions = conditions;
					  null;
					}

					Having.prototype.toString = function() {
					  return "HAVING " + this.conditions;
					};

					return Having;

				})();

				exports.Op = Op = (function() {

					function Op(operation, left, right) {
					  this.operation = operation;
					  this.left = left;
					  this.right = right;
					  null;
					}

					Op.prototype.toString = function() {
					  return "(" + this.left + " " + this.operation + " " + this.right + ")";
					};

					return Op;

				})();

				exports.Field = Field = (function() {

					function Field(field, name) {
					  this.field = field;
					  this.name = name != null ? name : null;
					  null;
					}

					Field.prototype.toString = function() {
					  if (this.name) {
						return "" + this.field + " AS " + this.name;
					  } else {
						return this.field.toString();
					  }
					};

					return Field;

				})();

				exports.Star = Star = (function() {

					function Star() {
					  null;
					}

					Star.prototype.toString = function() {
					  return '*';
					};

					Star.prototype.star = true;

					return Star;

				})();

			}).call(this);

		};

		require['./parser'] = new function() {
			var exports = this;
		   (function() {
		   
				var buildParser;

				buildParser = function() {
					var parser;
					parser = require('./compiled_parser').parser;
					parser.lexer = {
					  lex: function() {
						var tag, _ref;
						_ref = this.tokens[this.pos++] || [''], tag = _ref[0], this.yytext = _ref[1], this.yylineno = _ref[2];
						return tag;
					  },
					  setInput: function(tokens) {
						this.tokens = tokens;
						return this.pos = 0;
					  },
					  upcomingInput: function() {
						return "";
					  }
					};
					parser.yy = require('./nodes');
					return parser;
				};

				exports.parser = buildParser();

			    exports.parse = function(str) {
					return buildParser().parse(str);
				};

			}).call(this);

		};
		
		require['./sql_parser'] = new function() {
			var exports = this;
			(function() {

				exports.lexer = require('./lexer');

				exports.parser = require('./parser');

				exports.nodes = require('./nodes');

				exports.parse = function(sql) {
					return exports.parser.parse(exports.lexer.tokenize(sql));
				};

			}).call(this);

		};
		
		return require['./sql_parser']
	
    }();

    if(typeof define === 'function' && define.amd) {
		define(function() {
			return SQLParser;
		});
	}
	else {
		root.SQLParser = SQLParser;
	}
  
}(this));